home *** CD-ROM | disk | FTP | other *** search
/ Software of the Month Club 2000 October / Software of the Month - Ultimate Collection Shareware 277.iso / pc / PROGRAMS / UTILITY / WINLINUX / DATA1.CAB / programs_-_include / LINUX / B1LLI.H < prev    next >
C/C++ Source or Header  |  1999-09-17  |  5KB  |  193 lines

  1. /*
  2.  * $Id: b1lli.h,v 1.3 1998/01/31 10:54:37 calle Exp $
  3.  *
  4.  * ISDN lowlevel-module for AVM B1-card.
  5.  *
  6.  * Copyright 1996 by Carsten Paeth (calle@calle.in-berlin.de)
  7.  *
  8.  * $Log: b1lli.h,v $
  9.  * Revision 1.3  1998/01/31 10:54:37  calle
  10.  * include changes for PCMCIA cards from 2.0 version
  11.  *
  12.  * Revision 1.2  1997/12/10 19:38:42  calle
  13.  * get changes from 2.0 tree
  14.  *
  15.  * Revision 1.1.2.2  1997/11/26 16:57:26  calle
  16.  * more changes for B1/M1/T1.
  17.  *
  18.  * Revision 1.1.2.1  1997/11/26 10:47:01  calle
  19.  * prepared for M1 (Mobile) and T1 (PMX) cards.
  20.  * prepared to set configuration after load to support other D-channel
  21.  * protocols, point-to-point and leased lines.
  22.  *
  23.  * Revision 1.1  1997/03/04 21:27:32  calle
  24.  * First version in isdn4linux
  25.  *
  26.  * Revision 2.2  1997/02/12 09:31:39  calle
  27.  * new version
  28.  *
  29.  * Revision 1.1  1997/01/31 10:32:20  calle
  30.  * Initial revision
  31.  *
  32.  */
  33.  
  34. #ifndef _B1LLI_H_
  35. #define _B1LLI_H_
  36. /*
  37.  * struct for loading t4 file 
  38.  */
  39. typedef struct avmb1_t4file {
  40.     int len;
  41.     unsigned char *data;
  42. } avmb1_t4file;
  43.  
  44. typedef struct avmb1_loaddef {
  45.     int contr;
  46.     avmb1_t4file t4file;
  47. } avmb1_loaddef;
  48.  
  49. typedef struct avmb1_loadandconfigdef {
  50.     int contr;
  51.     avmb1_t4file t4file;
  52.         avmb1_t4file t4config; 
  53. } avmb1_loadandconfigdef;
  54.  
  55. typedef struct avmb1_resetdef {
  56.     int contr;
  57. } avmb1_resetdef;
  58.  
  59. typedef struct avmb1_getdef {
  60.     int contr;
  61.     int cardtype;
  62.     int cardstate;
  63. } avmb1_getdef;
  64.  
  65. /*
  66.  * struct for adding new cards 
  67.  */
  68. typedef struct avmb1_carddef {
  69.     int port;
  70.     int irq;
  71. } avmb1_carddef;
  72.  
  73. #define AVM_CARDTYPE_B1    0
  74. #define AVM_CARDTYPE_T1    1
  75. #define AVM_CARDTYPE_M1    2
  76. #define AVM_CARDTYPE_M2    3
  77.  
  78. typedef struct avmb1_extcarddef {
  79.     int port;
  80.     int irq;
  81.         int cardtype;
  82. } avmb1_extcarddef;
  83.  
  84. #define    AVMB1_LOAD        0    /* load image to card */
  85. #define AVMB1_ADDCARD        1    /* add a new card */
  86. #define AVMB1_RESETCARD        2    /* reset a card */
  87. #define    AVMB1_LOAD_AND_CONFIG    3    /* load image and config to card */
  88. #define    AVMB1_ADDCARD_WITH_TYPE    4    /* add a new card, with cardtype */
  89. #define AVMB1_GET_CARDINFO    5    /* get cardtype */
  90.  
  91.  
  92.  
  93. /*
  94.  * card states for startup
  95.  */
  96.  
  97. #define CARD_FREE    0
  98. #define CARD_DETECTED    1
  99. #define CARD_LOADING    2
  100. #define CARD_INITSTATE    4
  101. #define CARD_RUNNING    5
  102. #define CARD_ACTIVE    6
  103.  
  104. #ifdef __KERNEL__
  105.  
  106. #define    AVMB1_PORTLEN    0x1f
  107.  
  108. #define AVM_MAXVERSION    8
  109. #define AVM_NBCHAN    2
  110.  
  111. #define AVM_NAPPS    30
  112. #define AVM_NPLCI    5
  113. #define AVM_NNCCI    6
  114.  
  115. /*
  116.  * Main driver data
  117.  */
  118.  
  119. typedef struct avmb1_card {
  120.     struct avmb1_card *next;
  121.     int cnr;
  122.     unsigned short port;
  123.     unsigned irq;
  124.     int cardtype;
  125.     volatile unsigned short cardstate;
  126.     int interrupt;
  127.     int blocked;
  128.     int versionlen;
  129.     char versionbuf[1024];
  130.     char *version[AVM_MAXVERSION];
  131.     char msgbuf[128];    /* capimsg msg part */
  132.     char databuf[2048];    /* capimsg data part */
  133.     capi_version cversion;
  134.     char name[10];
  135. } avmb1_card;
  136.  
  137. /*
  138.  * Versions
  139.  */
  140.  
  141. #define    VER_DRIVER    0
  142. #define    VER_CARDTYPE    1
  143. #define    VER_HWID    2
  144. #define    VER_SERIAL    3
  145. #define    VER_OPTION    4
  146. #define    VER_PROTO    5
  147. #define    VER_PROFILE    6
  148. #define    VER_CAPI    7
  149.  
  150.  
  151. /* b1lli.c */
  152. int B1_detect(unsigned short base, int cardtype);
  153. void B1_reset(unsigned short base);
  154. int B1_load_t4file(unsigned short base, avmb1_t4file * t4file);
  155. int B1_load_config(unsigned short base, avmb1_t4file * config);
  156. int B1_loaded(unsigned short base);
  157. unsigned char B1_assign_irq(unsigned short base, unsigned irq, int cardtype);
  158. unsigned char B1_enable_irq(unsigned short base);
  159. unsigned char B1_disable_irq(unsigned short base);
  160. int B1_valid_irq(unsigned irq, int cardtype);
  161. void B1_handle_interrupt(avmb1_card * card);
  162. void B1_send_init(unsigned short port,
  163.         unsigned int napps, unsigned int nncci, unsigned int cardnr);
  164. void B1_send_register(unsigned short port,
  165.               __u16 appid, __u32 nmsg,
  166.               __u32 nb3conn, __u32 nb3blocks, __u32 b3bsize);
  167. void B1_send_release(unsigned short port, __u16 appid);
  168. void B1_send_message(unsigned short port, struct sk_buff *skb);
  169.  
  170. /* b1capi.c */
  171. void avmb1_handle_new_ncci(avmb1_card * card,
  172.                __u16 appl, __u32 ncci, __u32 winsize);
  173. void avmb1_handle_free_ncci(avmb1_card * card,
  174.                 __u16 appl, __u32 ncci);
  175. void avmb1_handle_capimsg(avmb1_card * card, __u16 appl, struct sk_buff *skb);
  176. void avmb1_card_ready(avmb1_card * card);
  177.  
  178. /* standard calls, with check and allocation of resources */
  179. int avmb1_addcard(int port, int irq, int cardtype);
  180. int avmb1_probecard(int port, int irq, int cardtype);
  181.  
  182.  
  183. int avmb1_resetcard(int cardnr);
  184.  
  185. /* calls for pcmcia driver */
  186. int avmb1_detectcard(int port, int irq, int cardtype);
  187. int avmb1_registercard(int port, int irq, int cardtype, int allocio);
  188. int avmb1_unregistercard(int cnr, int freeio);
  189.  
  190. #endif                /* __KERNEL__ */
  191.  
  192. #endif                /* _B1LLI_H_ */
  193.